import { useState } from 'react';

/*
 * @Date: 2024-01-31 20:25:35
 * @LastEditors: fromct 512799311@qq.com
 * @LastEditTime: 2024-01-31 20:57:20
 * @FilePath: /umi-max/src/hooks/ChatTongYi/index.tsx
 * @Description: desc
 */
export default function UseHooks(serviceName: any) {
  const [loading, setLoading] = useState(false);
  const [data, setData] = useState(null);

  async function getData() {
    try {
      setLoading(true);
      let resp = await serviceName();
      setData(resp);
      setLoading(false);
    } catch (e) {
      console.log(e);
    }
  }

  return { loading, getData, data };
}
